{extend name="/base/index"}
<!--右侧显示内容--顶部-->
{block name="right_bar_box_top"}
					<input type="hidden" id="ACTIVE_MENU" value="submeun-1" autocomplete="off">
					<div class="crumbs">
						<div class="container"> 管理系统&nbsp;&gt;&nbsp;个人中心 &nbsp;&gt;&nbsp;修改密码</div>
					</div>
{/block}
<!--左侧边--安全中心-->
{block name="left_bar_security"}
							<li class="submeun-2"><i class="ioc active"></i>
								<a class="l-m-icon active" href="/index.php/security/index.html">安全中心</a>
								<span class="active"></span>
							</li>
						</ul>
						<h3 class="myaccount">我的资金</h3>
						<ul class="menu-son">
{/block}
<!--右侧显示内容-->
{block name="right_bar_box"}
<div>
	<div class="page_title">
		修改密码&nbsp;&nbsp;
	</div>
	<form class="form-horizontal" action="loginpassword.html" method="POST" onsubmit="return false;" id="lgpwd_frm">
		<div class="form-group">
			<label class="col-sm-2 control-label">当前密码</label>
			<div class="col-md-4">
				<input type="password" class="form-control required" name="old_password" id="old_password" autocomplete="off">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">新密码</label>
			<div class="col-md-4">
				<input type="password" class="form-control required" name="password" id="password" autocomplete="off">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">新密码确认</label>
			<div class="col-md-4">
				<input type="password" class="form-control required" name="repassword" id="repassword" autocomplete="off">
			</div>
		</div>
		<div class="form-group">
			<div class="col-md-4 col-sm-offset-2">
				<button type="submit" id="btn_sub" class="btn btn-primary">提交</button>
			</div>
		</div>
	</form>
</div>
{/block}

<!--自定义页面js-->
{block name="self_js"}
<script type="text/javascript">
		$("#lgpwd_frm").submit(
			function(){
				if($("#password").val()!=$("#repassword").val()){
					$("#password").focus();
					layer.alert("两次密码不一致！");
					return false;
				}
				arusername=document.cookie.split(";")[0].split("=")[1];
//				console.log(arusername);
//				return false;
				var data = {"user_id":{$user_info.id},"old_password":$("#old_password").val(),"new_password":$("#password").val()	};
//				console.log(data);return false;
				$.ajax({
					type:"post",
					url:"/index.php/security/change_password",
					data:data,
					success:function(result){
//						console.log(result);
						if(result['code'] == 1){
							layer.msg('修改成功！请牢记您的密码！',{time:3000},function(){
								window.location.reload();
							});
						}else if(result['code'] == 0){							
							layer.confirm('温馨提示<br> 原始密码错误！',function(index){						    	
						    	window.location.reload();
						 });				    	
						}else{
							return false;
						}
					},
					error:function(result){
//						console.log(result);
					},
					async:true
				});
				
			}
		)
	</script>
{/block}